<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>欢迎页面</title>
</head>

<body>
    <div id="welcome"><span id="email"></span> 欢迎登录系统</div>
    <div id="nopower"><a href="login.html">返回登录</a> ｜ <a href="register.html">返回注册</a></div>
</body>
<script src="https://cdn.staticfile.org/jquery/3.4.0/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script>
    $(function () {
        $("#welcome").hide();
        $("#nopower").hide();


        $.ajax({
            url: "/api/user/info/" + $.cookie('token'),
            type: 'get',
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $("#nopower").show();
            },
            success: function (data, status) {
                if (data != "" || data != null) {
                    $("#email").html(data);
                    $("#welcome").show();
                }
            }
        });
    });

</script>

</html>